$(document).ready(function(e) {
    var slideshow=$(".slideshow");
	var ul=slideshow.find("ul");
	var showbutton=slideshow.find(".slidebutton span");
	var picwidth=slideshow.find("ul li").eq(0).width();
	var timer=null;
	var now=0;
	var speed=1;
	showbutton.bind("click",function(){
		$(this).addClass("active").siblings().removeClass("active");
		var index=$(this).index();
		now=index;
		ul.animate({"left":-(picwidth)*now})
	});
	function play(){
		timer=setInterval(function(){
			now=now+speed;
			if(now==3){
				speed=-1;
			}else{
				if(now==0){
					speed=1
				}
			}
			showbutton.eq(now).trigger("click");
		},2000)
	}
	play();
	slideshow.hover(function(){clearInterval(timer);},play);
});// JavaScript Document